package Two;
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		Person[] p = new Person[n];
		for (int i = 0; i < n; i++) {
			p[i] = new Person(scan.next(), scan.nextInt(), scan.nextBoolean());
		}
		for (int i = n - 1; i >= 0; i--) {
			System.out.println(p[i]);
		}
		System.out.println(new Person());
        scan.close();
	}
}
